package com.itheima.safe;

/**
 * @author Anomaly
 * @date 2023/2/10 15:47
 */
public class ThreadDemo {
    public static void main(String[] args) {
        Account account = new Account(10);
        new DrawThread(account, "小明").start();
        new DrawThread(account, "小红").start();
    }
}

class DrawThread extends Thread {
    private Account account;

    public DrawThread(Account account, String name) {
        super(name);
        this.account = account;
    }

    public Account getAccount() {
        return account;
    }

    public void setAccount(Account account) {
        this.account = account;
    }

    @Override
    public void run() {
        account.drawMoney(10);
    }
}
